package com.yuke.cloud.service.omc.dao;

import com.yuke.cloud.common.core.mybatis.MyMapper;
import com.yuke.cloud.service.api.omc.dto.DmsStoreOrderApi;
import com.yuke.cloud.service.api.omc.dto.OdsOrderApiDto;
import com.yuke.cloud.service.api.omc.dto.StoreOrderDto;
import com.yuke.cloud.service.omc.dto.OrderShopDto;
import com.yuke.cloud.service.omc.dto.ShopOrderGoodsDto;
import com.yuke.cloud.service.omc.entity.OdsOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;


@Mapper
@Component
public interface OdsOrderMapper extends MyMapper<OdsOrder> {

    List<OdsOrder> countsales(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> countsalesbyquarter(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> countsalesbymonth(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> selectAlrdyAmountDiscount(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> countAmountPayableByMonth(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> countsalesbyday(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> selectidbyquarter(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> selectidbymonth(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> selectidbyday(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map<String, Object>> selectidbyweek(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<OdsOrder> transferEveryday(@Param("day") Integer day);

    Integer batchupdate(@Param("list") List<OdsOrder> odsOrders);



    List<Map> recommond02(@Param("order_id") List<Long> order_id);

    //统计当周销售额
    List<Map> countsalesbyweek(@Param("shopid") Long shopid);

    //统计某个时间段的销售额，按天分类排序
    List<Map> countsalesbytime(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    //统计某个时间段的销售数量，按天分类
    List<Map> countnumbytime(@Param("begintime") Date begintime, @Param("endtime") Date endtinme, @Param("shopid") Long shopid);

    List<Map> getgoods(@Param("shopids") List<Long> list1);

    List<Map> getfinish();

    Map selectaddressbyid(@Param("id") Long id);

    Integer selectAlrdyAmountCheckout(@Param("shopId") Long shopId);

    //List<OrderShopDto> getOrderInformations(@Param("orderShopDto") OrderShopDto orderShopDto);

    List<OrderShopDto> findCountMoney(OrderShopDto orderShopDto);

    Integer findCountMoneyByShopId(OrderShopDto orderShopDto);

    List<Long> findAllShopId();

    List<OrderShopDto> getOrderInformation(OrderShopDto orderShopDto);

    List<OdsOrderApiDto> getLastOrderByShopIds(List<Long> shopList);

    List<OdsOrderApiDto> countByShopIds(@Param("shopIdList") List<Long> shopIdList, @Param("beginTime")Date beginTime, @Param("endTime")Date endTime);

    List<OdsOrderApiDto> countByShopIds(@Param("shopIdList") List<Long> shopIdList, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<DmsStoreOrderApi> countByDmsStore(List<DmsStoreOrderApi> dmsStoreOrderApis);

    List<ShopOrderGoodsDto> findOrderGoods(ShopOrderGoodsDto shopOrderGoodsDto);

    StoreOrderDto countByShopList(@Param("storeOrderDto") StoreOrderDto storeOrderDto, @Param("beginTime") String beginTime,@Param("endTime") String endTime);
}
